package com.zoro.barn.inner.service.documentsql.document.service;

import com.zoro.barn.inner.service.documentsql.document.dao.DocumentInfoMapper;
import com.zoro.barn.inner.service.documentsql.document.entity.DocumentInfo;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;
import java.util.List;

/**
 * @author zhaoxingwu
 */
@Service
public class DocumentInfoService {

    @Resource
    private DocumentInfoMapper documentInfoMapper;

    /**
     * calculate how many document related to one product, and include project document
     *
     * @param product product id
     * @return number
     */
    public Integer countByProduct(String product) {
        return this.documentInfoMapper.countByProduct(product);
    }

    /**
     * calculate how many document related to one project but don't include product document
     *
     * @param project project id
     * @return number
     */
    public Integer countByProject(String project) {
        return this.documentInfoMapper.countByProject(project);
    }

    public List<DocumentInfo> test() {
        return this.documentInfoMapper.test();
    }
}
